 

package com.zdkj.subway.rca.controller;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


import com.zdkj.common.core.util.R;


import com.zdkj.common.log.annotation.SysLog;

import com.zdkj.subway.rca.entity.SwCkInternetTicketEquipment;
import com.zdkj.subway.rca.mapper.SwCkInternetTicketEquipmentMapper;
import com.zdkj.subway.rca.service.SwCkInternetTicketEquipmentService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * 非现金收入审核 - 互联网售票机
 *
 * @author stw
 * @date 2020-09-25 09:20:23
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swauinternetticketequipment" )
@Api(value="swauinternetticketequipment", tags={"非现金收入审核-互联网售票机"})
public class SwCkInternetTicketEquipmentController {
    private static final Logger log = LoggerFactory.getLogger(SwCkInternetTicketEquipmentController.class);
    @Autowired
    private final SwCkInternetTicketEquipmentService swAuInternetTicketEquipmentService;
    @Resource
    SwCkInternetTicketEquipmentMapper swCkInternetTicketEquipmentMapper;

    /**
     * 分页查询
     * @param page 分页对象
     * @param
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwAuInternetTicketEquipmentPage(Page page, String lineCode, String startDate, String endDate) {
        SwCkInternetTicketEquipment swAuInternetTicketEquipment = new SwCkInternetTicketEquipment();
        swAuInternetTicketEquipment.setLineCode(lineCode);
        //return R.ok(swAuInternetTicketEquipmentService.page(page, Wrappers.query(swAuInternetTicketEquipment).lambda().ge(StringUtils.isNotEmpty(startDate), SwCkInternetTicketEquipment::getSettlementTime, startDate).le( StringUtils.isNotEmpty(endDate), SwCkInternetTicketEquipment::getSettlementTime, endDate)));
        return R.ok(swCkInternetTicketEquipmentMapper.getSwAuInternetTicketEquipmentPage(page,lineCode,startDate,endDate));
    }

    /**
     * 导出(分线路)
     * @param
     * @return
     * @throws IOException
     */
    @ApiOperation(value = "导出(分线路),多个线路编码用英文逗号分隔，为空全部导出；日期参数默认是当前月开始时间到当前时间，可以为空", notes = "导出(分线路),多个线路编码用英文逗号分隔，为空全部导出；日期参数默认是当前月开始时间到当前时间，可以为空")
    @GetMapping({"/exportGroupLine"})
    @SysLog("导出(分线路)")
    @PreAuthorize("@pms.hasPermission('sw_au_internet_ticket_equipment_exportGroupLine')")
    public void exportExcelGroupLine(String startDate, String endDate,String lineCodes,HttpServletResponse response){
        swAuInternetTicketEquipmentService.exportExcelGroupLine(startDate,endDate,lineCodes,response);
    }


    /**
     * 导出(分日期)
     * @param
     * @return
     * @throws IOException
     */
    @ApiOperation(value = "导出(分日期),默认是当前月开始时间到当前时间，参数可以为空", notes = "导出(分日期),默认是当前月开始时间到当前时间，参数可以为空")
    @GetMapping({"/exportGroupDate"})
    @SysLog("导出(分日期)")
    @PreAuthorize("@pms.hasPermission('sw_au_internet_ticket_equipment_exportGroupDate')")
    public void exportExcelGroupDate(String startDate, String endDate, HttpServletResponse response) {
        swAuInternetTicketEquipmentService.exportExcelGroupDate(startDate,endDate,response);
    }

}
